var form = layui.form;
layer = parent.layer === undefined ? layui.layer : top.layer,
    $ = layui.jquery;
function sub() {
    $.ajaxSettings.async = false;
    $.post("/user/login",{
        login_name : $("#yan1").val(),
        password : $("#yan2").val()
    },function(res){
        console.log("code"+res.msg);
        if(res.code===0){
            top.layer.msg("登陆成功！！！",{
                icon: 1,
                time: 2000 //2秒关闭（如果不配置，默认是3秒）
            });
            window.location.href = "/user/toMain";
        }else {
            top.layer.msg("账号或密码错误！！！！",{
                icon: 2,
                time: 2000 //2秒关闭（如果不配置，默认是3秒）
            });
        }
    });
}
